package practice2;

import java.util.Scanner;

public class P8627 {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int ans = n;
        int a;      //除数
        int b;      //模
        while(n>=3){
            a = n/3;
            b = n%3;
            ans+=a;
            n=a+b;
        }
        System.out.println(ans);
    }
}
